package JavaBase.Proxy;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Proxy;

public class Main {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        Subject subject = new SubjectImpl();
        System.out.println(subject.getClass());
        Subject subject1 = (Subject) Proxy.newProxyInstance(subject.getClass().getClassLoader(), subject.getClass().getInterfaces(),new JDKProxySubject(subject));
        try {
            subject1.request();
            System.out.println("a");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
